<?php
include("../../db_connect.php");
include("../../class/objName.php");

$ob = new objName();
$id = $_GET['codeid'];
$name = $ob->get_profile_name($id);
//$code = $ob->get_vcode($id);

?>
<script>
$(document).ready(function(){
var code = $("#code");
code.focus();
	$("#buttoncode").click(function (){

	if(code.val() == "" || code.val() == "" ){
	alert("enter your code");
	}
	else{
			$.ajax({
			url:"../scripts/codechecker.php?codeId="+<?php echo $id;?>+"&code="+code.val(),
			success:function(data){
				if(data == true){
					window.location.href = "../scripts/set_session.php?id="+<?php echo $id;?>
				}
				else{
					alert("Invalid verification code");
				}
			}
			});

	}

	});

})

</script>
<div id="msgbox"></div>
<label>Please enter your verification code <h5 style="color:Red;"><?php echo $name;?><h5></label>
<table width="100px" height="20px">
	<tr>
		
		<td>
			<label>EnterCode:</label>
		</td>
		<td>
			<input type="text" class="cat" id="code" style="color:black; size:14px;">
		</td>
		<td>
			<button id="buttoncode">verify</button>
		</td>
		
	</tr>
</table>
